﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufBase.h"

namespace gnuf {

    class StyleSheetComposer;

    class GNUF_BASE_EXPORT StyleSheet
    {
    public:
        enum EType {
            eToQPushButton = 0,
            eToQCheckBox,
            eToQLabel,
            eToQLineEdit,
            eToQTextEdit,
            eToQGroupBox,
            eToQTable,
            eToQDialog,
            eToQTabBar,
            eToQComboBox,
            eToQScrollBar,
            eToQTableView,
            eToQSpinBox,
            eToQDoubleSpinBox,
            eToQListWidget,
            eToQTreeWidget,
            eToQListView,
            eToQTabWidget,
            eToQRadioButton,
            eToQTreeView,
            eToQWidget,
            eToQSizeGrip,
            // === Bottom ===
            eNumber
        };

        explicit StyleSheet(StyleSheet::EType, const char * objectName);
        virtual ~StyleSheet();

        StyleSheet::EType type() const { return m_type; }
        const std::string & objectName() const { return m_objectName; }

        template <class TStyleSheet>
        TStyleSheet * cast()
        {
            if (TStyleSheet::Type == m_type)
                return static_cast<TStyleSheet*>(this);
            return nullptr;
        }

        template <class TStyleSheet>
        const TStyleSheet * constCast() const
        {
            if (TStyleSheet::Type == m_type)
                return static_cast<const TStyleSheet*>(this);
            return nullptr;
        }
    
        virtual std::string toString() const = 0;

    private:
        const StyleSheet::EType m_type;
        const std::string m_objectName;
    };

    class GNUF_BASE_EXPORT StyleSheetToQPushButton final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQPushButton(const char * objectName);
        virtual ~StyleSheetToQPushButton();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQCheckBox final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQCheckBox(const char * objectName);
        virtual ~StyleSheetToQCheckBox();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQLabel final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQLabel(const char * objectName);
        virtual ~StyleSheetToQLabel() {}
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQLineEdit final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQLineEdit(const char * objectName);
        virtual ~StyleSheetToQLineEdit() {}
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTextEdit final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTextEdit(const char * objectName);
        virtual ~StyleSheetToQTextEdit() {}
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQGroupBox final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQGroupBox(const char * objectName);
        virtual ~StyleSheetToQGroupBox();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTable final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTable(const char * objectName);
        virtual ~StyleSheetToQTable();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQDialog final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQDialog(const char * objectName);
        virtual ~StyleSheetToQDialog();
        virtual std::string toString() const override;
    };


    class GNUF_BASE_EXPORT StyleSheetToQTabBar final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTabBar(const char * objectName);
        virtual ~StyleSheetToQTabBar();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQComboBox final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQComboBox(const char * objectName);
        virtual ~StyleSheetToQComboBox();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQScrollBar final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQScrollBar(const char * objectName);
        virtual ~StyleSheetToQScrollBar();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTableView final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTableView(const char * objectName);
        virtual ~StyleSheetToQTableView();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQSpinBox final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQSpinBox(const char * objectName);
        virtual ~StyleSheetToQSpinBox();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQDoubleSpinBox final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQDoubleSpinBox(const char * objectName);
        virtual ~StyleSheetToQDoubleSpinBox();
        virtual std::string toString() const override;
    };
    class GNUF_BASE_EXPORT StyleSheetToQListWidget final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQListWidget(const char * objectName);
        virtual ~StyleSheetToQListWidget();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQListView final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQListView(const char * objectName);
        virtual ~StyleSheetToQListView();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTreeWidget final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTreeWidget(const char * objectName);
        virtual ~StyleSheetToQTreeWidget();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTreeView final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTreeView(const char * objectName);
        virtual ~StyleSheetToQTreeView();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQTabWidget final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQTabWidget(const char * objectName);
        virtual ~StyleSheetToQTabWidget();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQRadioButton final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQRadioButton(const char * objectName);
        virtual ~StyleSheetToQRadioButton();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQWidget final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQWidget(const char * objectName);
        virtual ~StyleSheetToQWidget();
        virtual std::string toString() const override;
    };

    class GNUF_BASE_EXPORT StyleSheetToQSizeGrip final : public StyleSheet
    {
    public:
        static const EType Type;
        explicit StyleSheetToQSizeGrip(const char* objectName);
        virtual ~StyleSheetToQSizeGrip();
        virtual std::string toString() const override;
    };
  
}
